<template>
  <div class="dialog-body" :style="{height:height+'px'}">
    <div class="app-container">
      <el-row :gutter="0">
        <el-col :span="24">
          <count v-if="checkPermission(['admin/Dashboard/index'])" @handlePanelDataCallback="handlePanelDataCallback"/>
        </el-col>
      </el-row>
      <el-row :gutter="0">
        <el-col :span="24">
          <member v-if="checkPermission(['admin/Dashboard/index'])" :chart-data="chartData"/>
        </el-col>
      </el-row>
      <el-row :gutter="10">
        <el-col :xs="24" :sm="14">
          <cms v-if="checkPermission(['admin/Dashboard/index'])"/>
        </el-col>
        <el-col :xs="24" :sm="10">
          <file v-if="checkPermission(['admin/Dashboard/index'])"/>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import screenHeight from '@/utils/screen-height'
import checkPermission from '@/utils/permission' // 权限判断函数
import Count from './components/Count'
import Member from './components/Member'
import Cms from './components/Cms'
import File from './components/File'

export default {
  name: 'Dashboard',
  components: {Count, Member, File, Cms},
  data() {
    return {
      height: 680,
      chartData: {}
    }
  },
  created() {
    this.height = screenHeight(100)
  },
  methods: {
    checkPermission,
    handlePanelDataCallback(type) {
      console.log(type)
    }
  }
}
</script>

<style lang="scss" scoped>
.app-container {
  background-color: rgb(240, 242, 245);

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 15px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
